|
Confluence Docs 3.0 : Module Type Plugins
This page last changed on Sep 07, 2009 by ggaskell.
On this page: Purpose of this Module TypeModule Type plugin modules allow you to dynamically add new plugin module types to the plugin framework, generally building on other plugin modules. For example, a plugin developer could create a <dictionary> plugin module that is used to feed a dictionary service used by still other plugins. ConfigurationThe root element for the Module Type plugin module is module-type. It allows the following attributes and child elements for configuration: Attributes
Elements
ExampleHere is an example atlassian-plugin.xml file containing a plugin module type:
<atlassian-plugin name="Hello World" key="example.plugin.helloworld" plugins-version="2">
<plugin-info>
<description>A dictionary module type test</description>
<vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
<version>1.0</version>
</plugin-info>
<module-type key="dictionary" class="example.plugin.DictionaryModuleDescriptor" />
</atlassian-plugin>
The Java code for DictionaryModuleDescriptor could look like this:
public class DictionaryModuleDescriptor extends AbstractModuleDescriptor<Dictionary>
{
private String language;
@Override
public void init(Plugin plugin, Element element) throws PluginParseException
{
super.init(plugin, element);
language = element.attributeValue("lang");
}
public Dictionary getModule()
{
return (Dictionary)((AutowireCapablePlugin)plugin).autowire(getModuleClass());
}
public String getLanguage()
{
return language;
}
}
This will add the new module type 'dictionary' to the plugin framework, allowing other plugins to use the new module type. Here is a plugin that uses the new 'dictionary' module type:
<atlassian-plugin name="Hello World" key="example.plugin.helloworld" plugins-version="2">
<plugin-info>
<description>An english dictionary</description>
<vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
<version>1.0</version>
</plugin-info>
<dictionary key="english" class="example.plugin.english.MyDictionary" />
</atlassian-plugin>
NotesSome information to be aware of when developing or configuring a Module Type plugin module:
RELATED TOPICSWriting Confluence Plugins Information sourced from Plugin Framework documentation |
| Document generated by Confluence on Nov 05, 2009 23:34 |